package org.springboot.sample.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springboot.sample.entity.User;

/**
 * 映射SQL语句的接口，无逻辑实现
 * @author estcele
 *
 */
@Mapper
public interface UserMapper {
	/**
	 * XML配置的方式<br>
	 * SQL配置在UserMapper.xml
	 * @param lastName
	 * @return
	 */
	List<User> likeName(String lastName);
	/**
	 * 使用SQL注解方式<br>
	 * 注意：数据库字段类型为uuid的，如果不使用uuid()方法而直接使用String当参数，会报异常 operator does not exist: uuid = character varying 
	 * @param id
	 * @return
	 */
	@Select("select id,first_name firstName,last_name lastName,date_updated dateUpdated,birthday birthDay from tbt_test where id=uuid(#{id})")
	User getById(String id);
	
	List<User> getAll();
}
